<?php

class Core_Backend_Component_Subject_View_Article_Index extends Core_Backend_Component_Article_View_Content_Index {

    protected function buildToolbar($toolbar) {
		parent::buildToolbar($toolbar);
		$toolbar->removeGroup();
		$toolbar->removeGroup('status');
		$toolbar->removeGroup('delete');
        $group = $toolbar->createGroup('status');
        $group->addButton($this->__('share.button.publish'))
                ->bindEvent('click', "submitGridChecked('" . $this->getGrid()->getId() . "', '" . $this->getUrl(array('status'=>'published'), 'review') . "')");
        $group->addButton($this->__('share.button.forbid'))
                ->bindEvent('click', "forbidGridChecked('" . $this->getGrid()->getId() . "', '" . $this->getUrl(array('status'=>'forbidden'), 'review') . "')");
        $group = $toolbar->createGroup('delete');
        $group->addButton($this->__('share.button.delete'))
                ->bindEvent('click', "submitGridChecked('" . $this->getGrid()->getId() . "', '" . $this->getUrl(NULL, 'deleteArticle') . "')");
    }

    protected function buildGrid($grid) {
        parent::buildGrid($grid);
        $grid->removeColumn('edit');
        $grid->removeColumn('status');
        $grid->removeColumn('preview');
        $grid->addLabelColumn($this->__('share.label.status'), 'subject_status', '{{lang "status.publication.{subject_status}"}}')
                ->setSortField('subject_status')
                ->setWidth(80);
        $grid->addLinkColumn('#', 'read', $this->getUrl(array('id' => '{id}'), 'read'), $this->__('subject.label.read'))
                ->setWidth(40)
                ->setAlign('center');                
    }

    protected function buildPagination($pagination) {
        $pagination->setUrlFormat($this->getPaginationUrl())->setRecordCount($this->getRecords());
        parent::buildPagination($pagination);
    }

}